﻿var socket = io.connect('http://192.168.1.204:8282');
//io.connect('http://192.168.158.1:8282');//io.connect('http://127.0.0.1:8282');//io.connect('http://192.168.1.204:8282');

Ext.define("Core.view.thaoluan.Thaoluan", {
    extend: "Ext.Container",
    xtype: "thaoluan",
    
    config: {
        items: [
        {
            xtype: "toolbar",
            scrollable: {
                direction: 'horizontal',
                indicators: false
            },
            items: [
                { iconCls: 'ok' },
            ]
        },
        {
            xtype: "fieldset",
            items: [
			{
                xtype: 'textareafield',
				minHeight: 200,
				maxHeight: 200,
				readOnly: true,
				id: "khungchat",
            },
            {
                xtype: 'textfield',
				id: "noidung",
            },
            ]
        },
		{
			id: "go",
            xtype: 'button',
            text: 'Send',
            ui: 'confirm',
            handler: function () {
                socket.emit('user-join', Ext.getCmp("noidung").getValue());
				Ext.getCmp("noidung").setValue("");
            }
        }
		],
    },
})

socket.on('new-user', function(data){
	Ext.getCmp("khungchat").setValue(data);
})